<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/ptTimeSelect/jquery.ptTimeSelect.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/ptTimeSelect/jquery.ptTimeSelect.css"/>" />
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript">
function doSubmit(){
    var t=$("#etitle").val();
	if (!t){
	   alert("please input title info!");
	   return;
	}
	$('#editForm').submit();
};
function goBack(){
	location.href='<s:url value="/system/TodoEvent/list"/>';
};

 $(document).ready(function(){
            $("#selstudent").autocomplete("<s:url value="/customer/Leads/autoCompleteAjax.action"/>", {
              width: 300,
              minChars:2, //几个字
              mastMatch:true,
              selectFirst: false,
              max:  20,
           	  formatItem: function(row, i, max) {
           	      //alert(row);
           	      var d=eval("("+row+")");
           	      //alert(d);
			      return  d.name+" "+ d.card +" " + d.tel;
	         },
		     formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return  d.name+" "+ d.card +" " + d.tel;
		     },
		     formatResult: function(row) {
		        // alert(row);
		         var d=eval("("+row+")");
			     return d.name+"["+ d.card +"][TEL:" + d.tel+"]";
     	      }
           });
           $("#selstudent").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selstudentid").val(d.id);
           });
           
            $("#seluser").autocomplete("<s:url value="/system/User/autoCompleteAjax.action"/>", {
              width: 300,
              minChars:1, //几个字
              mastMatch:true,
              selectFirst: false,
              max:  20,
           	  formatItem: function(row, i, max) {
           	      //alert(row);
           	      var d=eval("("+row+")");
           	      //alert(d);
			      return  d.name;
	         },
		     formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return  d.name;
		     },
		     formatResult: function(row) {
		        // alert(row);
		         var d=eval("("+row+")");
			     return d.name;
     	      }
           });
           $("#seluser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#seluserid").val(d.id);
           });
           if($.trim($('#result').text())!=''){
	         	popupDiv('pop-div');
	  };
	  $('#reminderStartTime').datepicker({dateFormat:'yy-mm-dd'});
	  $('#reminderEndTime').datepicker({dateFormat:'yy-mm-dd'});
	  $("div[id^='toObject']").hide();
	  var tt=$("input[name='toObject'][type='radio'][checked='checked']").val();
	  $("#toObject"+tt).show();
	  $('#todoEventStartTime').ptTimeSelect();
	  $('#todoEventEndTime').ptTimeSelect();
    });
    function doSelectToObject(event){
       $("div[id^='toObject']").hide();
       $("#toObject"+event.value).show();
    };
</script>
		<title><s:text name="system.title" />
		</title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td id="tag-over">
								<span id="tag-over">Event </span>
							</td>
							<td class="tab3-line" width="90%">
								&nbsp;
							</td>
						</tr>
					</table>
					<s:form action="TodoEvent/save" namespace="/system" method="post"
						id="editForm" name="editForm">
						<s:hidden name="id"></s:hidden>
						<table width="100%" border="0" cellpadding="3" cellspacing="1"
							class="margin">
							<tr>
								<td align="right" width="50%" class="tablecolour5">
									Title:
								</td>
								<td width="50%" class="tablecolour5">
									<s:textfield id="etitle" name="title" cssClass="input2" size="80" />
								</td>
							</tr>
							<tr>
								<td align="right" width="50%" class="tablecolour5">
									Type:
								</td>
								<td width="50%" class="tablecolour5">
									<s:radio name="todoType" listKey="name()"
										list="@com.ef.constant.EUserTodoType@values()" />
									<br>
									<div id="aaa">
										Select Somebody:
										<input id="selstudent" size="50" type="text"
											value="<s:property value="getSelLeadsInfo()"/>" />
										<s:hidden id="selstudentid" name="selLeadsId" />
									</div>
								</td>
							</tr>
							<tr>
								<td align="right" width="50%" class="tablecolour5">
									To:
								</td>
								<td width="50%" class="tablecolour5">
									<s:radio name="toObject" listKey="name()"
										list="@com.ef.constant.EUserTodoObject@values()"
										onclick="javascript:doSelectToObject(this);" />
									<div id="toObjectUser" title="toObjectUser">
										Select User:
										<input id="seluser" size="50" type="text"
											value="<s:property value="toUser.name"/>" />
										<s:hidden id="seluserid" name="toUserId" />
									</div>
									<div id="toObjectTeam" title="toObjectTeam">
										Select Team:
										<s:select name="toTeamId" headerKey=""
											headerValue="-----select-----" list="teamList" />
									</div>
									<div id="toObjectRole" title="toObjectRole">
										Select Role:
										<s:select name="toRoleId" headerKey=""
											headerValue="-----select-----" list="roleList" />
									</div>
									<div id="toObjectDepartment" title="toObjectDepartment">
										Select Department:
										<s:select name="toDepartmentId" headerKey=""
											headerValue="-----select-----" list="departmentList" />
									</div>
								</td>
							</tr>
							<tr>
								<td align="right" width="50%" class="tablecolour5">
									Valid Duration:
								</td>
								<td width="50%" class="tablecolour5">
									<s:date format="yyyy-MM-dd" name="reminderStartTime"
										var="tstartDate" />
									<s:textfield value="%{#tstartDate}" size="10"
										name="reminderStartTime" id="reminderStartTime" />
									Time:
									<s:textfield id="todoEventStartTime" name="todoEventStartTime"
										cssClass="input2" size="15" />
									To:
									<s:date format="yyyy-MM-dd" name="reminderEndTime"
										var="tendDate" />
									<s:textfield value="%{#tendDate}" size="10"
										name="reminderEndTime" id="reminderEndTime" />
									Time:
									<s:textfield id="todoEventEndTime" name="todoEventEndTime"
										cssClass="input2" size="15" />
								</td>
							</tr>
							<tr>
								<td align="right" width="50%" class="tablecolour5">
									Detail:
								</td>
								<td width="50%" class="tablecolour5">
									<s:textarea name="Detail" cols="80" rows="3" />
								</td>
							</tr>
							<tr>
								<td align="center" colspan="2" height="50" class="tablecolour5">
									<input type="button" class="btn1" value="Save"
										onclick="doSubmit();" />
									<input name="goback" type="button" class="btn1" value="Go Back"
										onclick="goBack()" />
								</td>
							</tr>
						</table>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
		<div id='pop-div' style="width: 300px;" class="pop-box">
			<s:include value="/common/confirm.jsp"></s:include>
		</div>
	</body>
</html>